<template>
  <div class="recommend-content">
    <!-- 头部区域 -->
    <div class="header-section">
      <img src="/images/主体页面组件/头部header.svg" alt="头部背景" class="header-bg" />
      <div class="header-content">
        <img src="/images/主体页面组件/头部蓝酒馆logo.svg" alt="蓝酒馆logo" class="header-logo" />
        <img src="/images/主体页面组件/头部slogan.svg" alt="slogan" class="header-slogan" />
      </div>
    </div>

    <!-- 主内容区域 -->
    <div class="main-content">
      <!-- 推荐关注标题栏 -->
      <div class="recommend-tabs">
        <button class="tab-item active" @click="switchTab('recommend')">
          <img src="/images/主体页面组件/推荐 关注标题1.svg" alt="推荐" />
        </button>
        <button class="tab-item" @click="switchTab('follow')">
          <img src="/images/主体页面组件/推荐 关注标题2.svg" alt="关注" />
        </button>
      </div>

      <!-- 推荐关注内容区域 -->
      <div class="recommend-follow-section">
        <!-- 推荐内容 -->
        <div v-if="activeTab === 'recommend'" class="recommend-content-area">
          <img src="/images/主体页面组件/推荐关注模拟数据.svg" alt="推荐关注数据" class="recommend-data" />
          
          <!-- 店长推荐板块 -->
          <div class="recommendation-section">
            <img src="/images/主体页面组件/店长推荐板块bg.svg" alt="店长推荐内容" class="recommendation-bg" />
            <div class="recommendation-overlay">
              <img src="/images/主体页面组件/店长推荐板块标题.svg" alt="店长推荐" class="section-title-overlay" />
              <button class="more-btn-overlay">
                <img src="/images/主体页面组件/更多.svg" alt="更多" />
              </button>
            </div>
            <div class="books-container">
              <div class="book-item">
                <img src="/images/店长推荐/白夜行封面.svg" alt="白夜行封面" class="book-cover" />
                <img src="/images/店长推荐/白夜行书名.svg" alt="白夜行" class="book-title" />
              </div>
              <div class="book-item">
                <img src="/images/店长推荐/悲惨世界封面.svg" alt="悲惨世界封面" class="book-cover" />
                <img src="/images/店长推荐/悲惨世界书名.svg" alt="悲惨世界" class="book-title" />
              </div>
              <div class="book-item">
                <img src="/images/店长推荐/围城封面.svg" alt="围城封面" class="book-cover" />
                <img src="/images/店长推荐/围城书名.svg" alt="围城" class="book-title" />
              </div>
            </div>
          </div>

          <!-- 热门书评板块 -->
          <div class="hot-reviews-section">
            <img src="/images/主体页面组件/热门书评板块bg.svg" alt="热门书评内容" class="hot-reviews-bg" />
            <div class="hot-reviews-overlay">
              <img src="/images/主体页面组件/热门书评板块标题.svg" alt="热门书评" class="section-title-overlay" />
              <button class="more-btn-overlay">
                <img src="/images/主体页面组件/更多.svg" alt="更多" />
              </button>
            </div>
            <div class="reviews-container">
              <!-- 评论1 -->
              <div class="review-item">
                <img src="/images/主体页面组件/热门板块数据方框.svg" alt="评论框" class="review-frame" />
                <div class="review-content">
                  <div class="review-header">
                    <img src="/images/热门书评/用户头像1.svg" alt="用户头像" class="user-avatar" />
                    <div class="user-info">
                      <img src="/images/热门书评/用户名字1.svg" alt="用户名" class="user-name" />
                      <img src="/images/热门书评/用户时间1.svg" alt="时间" class="review-time" />
                    </div>
                    <button class="follow-btn">
                      <img src="/images/主体页面组件/关注按钮.svg" alt="关注" />
                    </button>
                  </div>
                  <div class="review-body">
                    <img src="/images/热门书评/用户评论1.svg" alt="评论内容" class="review-text" />
                    <div class="book-detail">
                      <img src="/images/主体页面组件/用户评论书籍bg.svg" alt="书籍背景" class="book-bg" />
                      <div class="book-content">
                        <img src="/images/热门书评/用户评论书籍封面1.svg" alt="书籍封面" class="book-cover-detail" />
                        <div class="book-info">
                          <img src="/images/热门书评/用户评论书籍名1.svg" alt="书名" class="book-name" />
                          <img src="/images/热门书评/用户评论书籍推荐指数星星1.svg" alt="评分" class="book-rating" />
                          <img src="/images/热门书评/用户推荐书籍分类.svg" alt="分类" class="book-category" />
                          <img src="/images/热门书评/用户评价like数.svg" alt="点赞数" class="book-likes" />
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              <!-- 评论2 -->
              <div class="review-item">
                <img src="/images/主体页面组件/热门板块数据方框.svg" alt="评论框" class="review-frame" />
                <div class="review-content">
                  <div class="review-header">
                    <img src="/images/热门书评/用户头像2.svg" alt="用户头像" class="user-avatar" />
                    <div class="user-info">
                      <img src="/images/热门书评/用户名字2.svg" alt="用户名" class="user-name" />
                      <img src="/images/热门书评/用户时间2.svg" alt="时间" class="review-time" />
                    </div>
                    <button class="follow-btn">
                      <img src="/images/主体页面组件/关注按钮.svg" alt="关注" />
                    </button>
                  </div>
                  <div class="review-body">
                    <img src="/images/热门书评/用户评论2.svg" alt="评论内容" class="review-text" />
                    <div class="book-detail">
                      <img src="/images/主体页面组件/用户评论书籍bg.svg" alt="书籍背景" class="book-bg" />
                      <div class="book-content">
                        <img src="/images/热门书评/用户评论书籍封面1.svg" alt="书籍封面" class="book-cover-detail" />
                        <div class="book-info">
                          <img src="/images/热门书评/用户评论书籍名1.svg" alt="书名" class="book-name" />
                          <img src="/images/热门书评/用户评论书籍推荐指数星星1.svg" alt="评分" class="book-rating" />
                          <img src="/images/热门书评/用户推荐书籍分类.svg" alt="分类" class="book-category" />
                          <img src="/images/热门书评/用户评价like数.svg" alt="点赞数" class="book-likes" />
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              <!-- 评论3 -->
              <div class="review-item">
                <img src="/images/主体页面组件/热门板块数据方框.svg" alt="评论框" class="review-frame" />
                <div class="review-content">
                  <div class="review-header">
                    <img src="/images/热门书评/用户头像3.svg" alt="用户头像" class="user-avatar" />
                    <div class="user-info">
                      <img src="/images/热门书评/用户名字3.svg" alt="用户名" class="user-name" />
                      <img src="/images/热门书评/用户时间3.svg" alt="时间" class="review-time" />
                    </div>
                    <button class="follow-btn">
                      <img src="/images/主体页面组件/关注按钮.svg" alt="关注" />
                    </button>
                  </div>
                  <div class="review-body">
                    <img src="/images/热门书评/用户评论2.svg" alt="评论内容" class="review-text" />
                    <div class="book-detail">
                      <img src="/images/主体页面组件/用户评论书籍bg.svg" alt="书籍背景" class="book-bg" />
                      <div class="book-content">
                        <img src="/images/热门书评/用户评论书籍封面1.svg" alt="书籍封面" class="book-cover-detail" />
                        <div class="book-info">
                          <img src="/images/热门书评/用户评论书籍名1.svg" alt="书名" class="book-name" />
                          <img src="/images/热门书评/用户评论书籍推荐指数星星1.svg" alt="评分" class="book-rating" />
                          <img src="/images/热门书评/用户推荐书籍分类.svg" alt="分类" class="book-category" />
                          <img src="/images/热门书评/用户评价like数.svg" alt="点赞数" class="book-likes" />
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              <!-- 评论4 -->
              <div class="review-item">
                <img src="/images/主体页面组件/热门板块数据方框.svg" alt="评论框" class="review-frame" />
                <div class="review-content">
                  <div class="review-header">
                    <img src="/images/热门书评/用户头像4.svg" alt="用户头像" class="user-avatar" />
                    <div class="user-info">
                      <img src="/images/热门书评/用户名字4.svg" alt="用户名" class="user-name" />
                      <img src="/images/热门书评/用户时间4.svg" alt="时间" class="review-time" />
                    </div>
                    <button class="follow-btn">
                      <img src="/images/主体页面组件/关注按钮.svg" alt="关注" />
                    </button>
                  </div>
                  <div class="review-body">
                    <img src="/images/热门书评/用户评论4.svg" alt="评论内容" class="review-text" />
                    <div class="book-detail">
                      <img src="/images/主体页面组件/用户评论书籍bg.svg" alt="书籍背景" class="book-bg" />
                      <div class="book-content">
                        <img src="/images/热门书评/用户评论书籍封面1.svg" alt="书籍封面" class="book-cover-detail" />
                        <div class="book-info">
                          <img src="/images/热门书评/用户评论书籍名1.svg" alt="书名" class="book-name" />
                          <img src="/images/热门书评/用户评论书籍推荐指数星星1.svg" alt="评分" class="book-rating" />
                          <img src="/images/热门书评/用户推荐书籍分类.svg" alt="分类" class="book-category" />
                          <img src="/images/热门书评/用户评价like数.svg" alt="点赞数" class="book-likes" />
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 关注内容 -->
        <div v-if="activeTab === 'follow'" class="follow-content-area">
          <div class="empty-state">
            <p>暂无关注内容</p>
          </div>
        </div>
      </div>
    </div>

    <!-- 底部导航栏 -->
    <div class="bottom-nav">
      <img src="/images/主体页面组件/底部导航栏bg.svg" alt="导航背景" class="nav-bg" />
      <div class="nav-items">
        <button class="nav-item" @click="$router.push('/home')">
          <img src="/images/主体页面组件/首页logo.svg" alt="首页" />
          <span class="nav-text">首页</span>
        </button>
        <button class="nav-item active">
          <img src="/images/主体页面组件/推荐logo.svg" alt="推荐" />
          <span class="nav-text">推荐</span>
        </button>
        <button class="nav-item" @click="$router.push('/bookshelf')">
          <img src="/images/主体页面组件/书架logo.svg" alt="书架" />
          <span class="nav-text">书架</span>
        </button>
        <button class="nav-item" @click="$router.push('/my')">
          <img src="/images/主体页面组件/我的logo.svg" alt="我的" />
          <span class="nav-text">我的</span>
        </button>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'

// 标签页切换逻辑
const activeTab = ref('recommend')

const switchTab = (tab: string) => {
  activeTab.value = tab
}
</script>

<style scoped>
.recommend-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  background: rgb(255, 255, 255);
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  /* 禁用文本选择和拖拽 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* 头部区域样式 */
.header-section {
  position: relative;
  width: 100%;
  height: 65px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  background: #A2F2F8;
}

.header-bg {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
}

.header-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.header-logo {
  height: 30px;
  width: auto;
  transform: translateY(35%) translateX(10%);
}

.header-slogan {
  height: 40px;
  width: auto;
  transform: translateY(35%) translateX(50%);
}

/* 主内容区域样式 */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 15px;
  padding-bottom: 130px; /* 为导航栏留出空间 */
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0;
  min-height: 0;
  /* 启用移动端原生滑动 */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* 隐藏滚动条 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* 完全隐藏滚动条 */
.main-content::-webkit-scrollbar {
  display: none;
}

/* 推荐关注标题栏 */
.recommend-tabs {
  display: flex;
  margin-bottom: 10px;
  background: transparent;
  padding: 0;
  gap: -10px;
  align-items: center;
}

.tab-item {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  margin-right: -20px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.tab-item:last-child {
  margin-right: 0;
  transform: translateX(-55%);
}

.tab-item:hover {
  opacity: 0.8;
}

.tab-item.active {
  opacity: 1;
}

.tab-item img {
  height: 35px;
  width: auto;
}

/* 推荐关注内容区域 */
.recommend-follow-section {
  flex: 1;
  background: transparent;
  padding: 0;
}

.recommend-content-area,
.follow-content-area {
  width: 100%;
  height: 100%;
}

.recommend-data {
  width: 120%;
  height: auto;
  object-fit: contain;
  transform: translateX(0%);
  margin-top: 10px;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #999;
  font-size: 16px;
}

/* 店长推荐板块样式 */
.recommendation-section {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 20px;
  margin-bottom: 25px;
  transform: translateY(0);
  min-height: 200px;
  height: auto;
  padding-bottom: 20px;
}

.recommendation-bg {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  position: relative;
  z-index: 1;
}

.recommendation-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 15px 20px;
  z-index: 5;
}

.section-title-overlay {
  height: 25px;
  width: auto;
}

.more-btn-overlay {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s ease;
}

.more-btn-overlay:hover {
  transform: scale(1.1);
}

.more-btn-overlay img {
  height: 20px;
  width: auto;
}

.books-container {
  position: absolute;
  bottom: 15px;
  left: 15px;
  right: 15px;
  top: 50px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-content: flex-start;
  gap: 10px;
  overflow: hidden;
  padding: 5px;
  z-index: 10;
}

.book-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 1 calc(33.333% - 8px);
  min-width: 70px;
  max-width: 90px;
  cursor: pointer;
  transition: transform 0.2s ease;
  margin-bottom: 5px;
}

.book-item:hover {
  transform: translateY(-2px);
}

.book-cover {
  width: 60px;
  height: 75px;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 5px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  background: transparent;
}

.book-title {
  width: auto;
  height: 16px;
  object-fit: contain;
  z-index: 15;
  position: relative;
}

/* 热门书评板块样式 */
.hot-reviews-section {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 20px;
  margin-bottom: 25px;
  min-height: 800px;
  height: auto;
}

.hot-reviews-bg {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  position: relative;
  z-index: 1;
}

.hot-reviews-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 15px 20px;
  z-index: 5;
}

.reviews-container {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 0;
  margin-top: 15px;
  padding: 0 15px;
  z-index: 10;
  overflow-y: auto;
  /* 隐藏滚动条但保持滚动功能 */
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* 启用移动端原生滑动 */
  -webkit-overflow-scrolling: touch;
}

/* 隐藏webkit滚动条 */
.reviews-container::-webkit-scrollbar {
  display: none;
}

.review-item {
  position: relative;
  margin-bottom: 15px;
  cursor: pointer;
  transition: transform 0.2s ease;
  min-height: 300px;
}

.review-item:hover {
  transform: translateY(-2px);
}

.review-frame {
  width: 100%;
  height: auto;
  display: block;
  z-index: 1;
}

.review-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 15px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
}

.review-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.user-name {
  height: 16px;
  width: auto;
  object-fit: contain;
  object-position: left;
}

.review-time {
  height: 12px;
  width: auto;
  object-fit: contain;
  object-position: left;
}

.follow-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  position: absolute;
  top: 0;
  right: 0;
  transition: transform 0.2s ease;
}

.follow-btn:hover {
  transform: scale(1.05);
}

.follow-btn img {
  width: 49px;
  height: 18px;
}

.review-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 5px;
  flex: 1;
}

.review-text {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: left top;
  min-height: 60px;
  display: block;
  flex-shrink: 0;
}

/* 书籍详情区域 */
.book-detail {
  position: relative;
  align-self: center;
  margin-top: 0px;
  width: 98%;
  max-width: 340px;
  height: 120px;
  transform: translateY(-10%);
}

.book-bg {
  width: 100%;
  height: 100%;
  object-fit: fill;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.book-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px;
  z-index: 2;
  display: flex;
  gap: 10px;
  align-items: center;
}

.book-cover-detail {
  width: 35px;
  height: 50px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 3px;
}

.book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  position: relative;
}

.book-name {
  height: 12px;
  width: auto;
  object-fit: contain;
  object-position: left;
}

.book-rating {
  height: 10px;
  width: auto;
  object-fit: contain;
  object-position: left;
}

.book-category {
  height: 10px;
  width: auto;
  object-fit: contain;
  object-position: left;
}

.book-likes {
  height: 18px;
  width: auto;
  object-fit: contain;
  object-position: right;
  position: absolute;
  bottom: 0;
  right: -15%;
}

/* 底部导航栏样式 */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  z-index: 9999;
  margin: 0;
  padding: 0;
  background: transparent;
  padding-top: 5px;
}

.nav-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-items {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 0px 20px 20px 20px;
}

.nav-item {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px 12px 8px;
  transition: transform 0.2s ease;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

.nav-item:hover {
  transform: scale(1.1);
}

.nav-item.active {
  background: rgba(0, 212, 255, 0.1);
}

.nav-item img {
  height: 32px;
  width: auto;
}

.nav-text {
  font-size: 12px;
  color: #ffffff;
  font-weight: 400;
  margin-top: 2px;
}

.nav-item.active .nav-text {
  color: #0033ff;
  font-weight: 500;
}

/* 响应式调整 */
@media (max-height: 700px) {
  .header-section {
    height: 100px;
  }
  
  .main-content {
    padding: 15px 12px;
    padding-bottom: 90px;
    gap: 20px;
  }
  
  .bottom-nav {
    bottom: 0;
    height: 100px;
    padding-top: 5px;
  }
  
  .nav-item img {
    height: 28px;
  }
  
  .nav-text {
    font-size: 11px;
  }
}

@media (max-width: 399px) {
  .recommend-tabs {
    padding: 8px;
  }
  
  .tab-item {
    padding: 6px 12px;
  }
  
  .tab-item img {
    height: 22px;
  }
  
  .recommend-follow-section {
    padding: 12px;
  }
}
</style> 